package com.example.tianyidemo.controller;
import com.example.tianyidemo.pojo.Result;
import com.example.tianyidemo.pojo.Section;
import com.example.tianyidemo.service.UpdatesectionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Slf4j
@CrossOrigin//准许跨域请求
@RestController
public class UpdatesetionController {
    @Autowired
    private UpdatesectionService updatesectionService;
    @PutMapping("/updateSection")
    public Result updateSection(@RequestBody Section section) {
        boolean isSuccess = updatesectionService.updateSection(section);
        if (isSuccess) {
            return Result.success("更新成功");
        } else {
            return Result.error("更新失败");
        }
    }
}
